package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 交易类型(1-补贴充值，2-补贴扣款，3-充值手续费，4-营销补贴服务费)
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum SubsidyTradeTypeEnum {

    RECHARGE(1, "补贴充值"),
    DEDUCTION(2, "补贴扣款"),
    FEE(3, "手续费"),
    SERVICE(3, "营销补贴服务费"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    SubsidyTradeTypeEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static SubsidyTradeTypeEnum typeOf(Integer value) {
        SubsidyTradeTypeEnum[] values = SubsidyTradeTypeEnum.values();
        for (SubsidyTradeTypeEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static SubsidyTradeTypeEnum typeOf(String name) {
        SubsidyTradeTypeEnum[] values = SubsidyTradeTypeEnum.values();
        for (SubsidyTradeTypeEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
